package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.BuyerBean;
import com.project.service.IBuyerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * @Title: BuyerController
 * @Package: com.project.controller
 * @Description:
 * @Author: Liang-Xie
 */
@SuppressWarnings("all")
@RestController
@RequestMapping("buyer")
public class BuyerController {
    @Autowired
    private IBuyerService buyerService;
    @RequestMapping("findByItem")
    public IPage<BuyerBean> findByItem(Integer pageNO, String name, LocalDate startDate, LocalDate endDate){
        return buyerService.findByItem(pageNO, name, startDate, endDate);
    }
    @RequestMapping("findById")
    public BuyerBean findById(Integer buyerId){
        return buyerService.findById(buyerId);
    }
    @RequestMapping("add")
    public String add(BuyerBean buyer, Integer userId){
        buyerService.add(buyer, userId);
        return "ok";
    }
}
